﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;

namespace RealEstate.Models
{
    public partial class Client
    {
        public string FullName
        {
            get
            {
                if (!string.IsNullOrEmpty(this._FirstName) && !string.IsNullOrEmpty(this._LastName))
                {
                    return string.Concat(this._LastName, " ", this._FirstName);
                }
                else if (!string.IsNullOrEmpty(this._FirstName))
                {
                    return this._FirstName;
                }
                else if (!string.IsNullOrEmpty(this._LastName))
                {
                    return this._LastName;
                }

                return string.Empty;
            }
        }

        public string UserName
        {
            get
            {
                if (UserId != null)
                {
                    var user = Membership.GetUser(UserId);
                    return user.UserName;
                }

                return string.Empty;
            }
        }

        public bool Active
        {
            get
            {
                if (UserId != null)
                {
                    var user = Membership.GetUser(UserId);
                    return user.IsApproved;
                }

                return false;
            }
        }
    }
}